-- card: 7597 from stack: in -- bmap block id: 7696 -- flags: 0000 -- background id: 7022 -- name: HyperTyper ----- HyperTalk script ----- on openCard global typerMenu put NewMenu("HyperTyper","New","Open","Save","Save As…", "(-","Print","QuickPrint","(-","Quit") into typerMenu pass openCard end openCard on closeCard global typerMenu hide card field 2 doNew get deleteMenu(typerMenu) put empty into typerMenu if the freesize of this stack is not 0 then doMenu "Compact Stack" pass closeCard end closeCard on idle global typerMenu global lastTick if (the ticks-lastTick)>30 then -- gives better -- performance than on every iteration put the ticks into lastTick if field 1 is empty then EnableMenu typerMenu,3,"false" EnableMenu typerMenu,4,"false" EnableMenu typerMenu,6,"false" EnableMenu typerMenu,7,"false" else EnableMenu typerMenu,3,"true" EnableMenu typerMenu,4,"true" EnableMenu typerMenu,6,"true" EnableMenu typerMenu,7,"true" end if end if pass idle end idle on doError which Answer which with "OK" end doError on doNew global windowDirty,typerFile if field 1 is not empty then if windowDirty is "true" then answer "Save changes?" with "Cancel" or "No" or "Yes" if it is "Cancel" then exit doNew else if it is "Yes" then doSave end if put empty into field 1 end if put "false" into windowDirty put "Untitled" into card field "FileName" set the name of field 1 to card field "FileName" put empty into typerFile end doNew on doOpen global windowDirty,typerFile if windowDirty is "true" then if field 1 is not empty then answer "Save changes?" with "Cancel" or "No" or "Yes" if it is "Cancel" then exit to HyperCard else if it is "Yes" then doSave end if end if FileToField "field 1" put the Result into theResult if theResult is not empty then if word 1 of theResult is "Error" then doError theResult exit doOpen else if theResult is "Cancel" then exit doOpen put theResult into typerFile put LastPathComponent(typerFile) into card field "FileName" set the name of field 1 to card field "FileName" put "false" into windowDirty end if end doOpen on doSave global windowDirty,typerFile if the short name of field 1 is not "Untitled" then FieldToFile "field 1",typerFile if the Result is "Cancel" then exit to HyperCard else put "false" into windowDirty put the Result into theResult if word 1 of theResult is "Error" then doError theResult end if end if else doSaveAs end if end doSave on doSaveAs global windowDirty,typerFile FieldToFile "field 1" put the Result into theResult if word 1 of theResult is "Error" then doError theResult exit doSaveAs end if if theResult is "Cancel" then exit to Hypercard else put theResult into typerFile put LastPathComponent(typerFile) into card field "FileName" put "false" into windowDirty end if end doSaveAs on doPrint if field 1 is not empty then PrintField "field 1" end doPrint on doQuickPrint if field 1 is not empty then TextStream "field 1",8,10,4,4 end doQuickPrint on doQuit visual effect dissolve go to card 1 end doQuit on doMenu it if it is "New" then doNew else if it is "Open" then doOpen else if it is "Save" then doSave else if it is "Save As…" then doSaveAs else if it is "Print" then doPrint else if it is "QuickPrint" then doQuickPrint else if it is "Quit" then doQuit else pass doMenu end doMenu on openField global windowDirty,typerMenu if the number of the target is 1 then put "true" into windowDirty end if pass openField end openField -- part 1 (field) -- low flags: 01 -- high flags: 0000 -- rect: left=160 top=38 right=56 bottom=352 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: FileName -- part 2 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=477 top=54 right=63 bottom=494 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: ScrollToTop ----- HyperTalk script ----- on mouseUp set scroll of field 1 to 0 end mouseUp -- part 4 (button) -- low flags: 00 -- high flags: 2000 -- rect: left=354 top=31 right=62 bottom=385 -- title width / last selected line: 0 -- icon id / first selected line: 32462 / 32462 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: ----- HyperTalk script ----- on mouseUp set visible of card field 2 to not visible of card field 2 end mouseUp -- part 5 (button) -- low flags: 00 -- high flags: 2000 -- rect: left=393 top=28 right=59 bottom=432 -- title width / last selected line: 0 -- icon id / first selected line: 1007 / 1007 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: ----- HyperTalk script ----- on mouseUp doMenu "Print" end mouseUp -- part 6 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=437 top=32 right=60 bottom=472 -- title width / last selected line: 0 -- icon id / first selected line: 20098 / 20098 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: ----- HyperTalk script ----- on mouseUp go home end mouseUp -- part 7 (field) -- low flags: 81 -- high flags: 2002 -- rect: left=22 top=62 right=326 bottom=494 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 20 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: HyperTyper Help ----- HyperTalk script ----- on mouseup set the visible of me to false end mouseup -- part 8 (button) -- low flags: 00 -- high flags: 2000 -- rect: left=473 top=29 right=53 bottom=495 -- title width / last selected line: 0 -- icon id / first selected line: 1012 / 1012 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Pop Card ----- HyperTalk script ----- on mouseUp visual effect dissolve pop card end mouseUp -- part contents for card part 1 ----- text ----- Untitled -- part contents for card part 7 ----- text ----- HyperTyper 1.1 Kevin Calhoun HyperTyper is a text editor built in HyperCard with the XCMD's from Dartmouth College and the menu XCMD's from Nine to Five Software. It works much like the popular desk accessory text editors, reading and writing text files of less than 30K in size. "Open," "Save," and "Save As..." in the HyperTyper menu act on files of type TEXT, the kind of file you get if you save a file as "Text Only" in most word processors. You can set the font, font size, line height, alignment, and text style of the field as you normally do in HyperCard. Choosing "Print" from the HyperTyper menu invokes the PrintField XCMD, which will print the text according to your settings. Choosing "QuickPrint" invokes the TextStream XCMD, which will give you hardcopy in your printer's default monospaced font.